package com.zjitc.service.impl;

import com.zjitc.dao.AdminUserDao;
import com.zjitc.dao.UserDao;
import com.zjitc.pojo.Admin;
import com.zjitc.pojo.Car;
import com.zjitc.pojo.User;
import com.zjitc.redis.AllSql;
import com.zjitc.redis.Redis;
import com.zjitc.service.AdUserService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import redis.clients.jedis.Jedis;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/6/4 16:27
 * @description:
 */
@Service
public class AdUserServiceImpl implements AdUserService{

  @Autowired
  private AdminUserDao adminUserDao;
  @Autowired
  private UserDao userDao;
  @Autowired
  private Redis redis;


  @Override
  public Admin findByCondition(String adminuser, String adminpassword) {
    return adminUserDao.findByCondition(adminuser,adminpassword);
  }

  @Override
  public List<User> findUserList() {
    return adminUserDao.findUserList();
  }

  @Override
  public List<Car> findProductAll() {
    List<Car> productList=adminUserDao.findProductAll();
    return productList;
  }

  @Override
  public void productAdd(Car product) {
    adminUserDao.productAdd(product);
    AllSql.AllSql(redis,userDao,adminUserDao);
  }

  @Override
  public Car editProudctUI(Integer carid) {
    return adminUserDao.editProductUI(carid);
  }

  @Override
  public void productDeletePid(Integer carid) {
    adminUserDao.productDeletePid(carid);
    AllSql.AllSql(redis,userDao,adminUserDao);
  }

  @Override
  public void productEdit(Car product) {
    adminUserDao.productEdit(product);
    AllSql.AllSql(redis,userDao,adminUserDao);
  }

  @Override
  public void deleteUser(Integer id) {
    adminUserDao.deleteUser(id);
  }

}
